<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table,
        td {
            border: 1px solid;
            
            border-collapse: collapse;
        }
    </style>
</head>

<body>
    <table>
        <tr>
            <td>1-1</td>
            <td>1-2</td>
            <td>1-3</td>
        </tr>
        <tr>
            <td>2-1</td>
            <td>2-2</td>
            <td>2-3</td>
        </tr>
        <tr>
            <td>3-1</td>
            <td>3-2</td>
            <td>3-3</td>
        </tr>
        <script>
            let td = document.querySelectorAll('tr');
            for (let item of td) {
               item.onmouseover =function(){
                item.style.backgroundColor = 'red';
               }
               item.onmouseout=function(){
                item.style.backgroundColor = '#fff';
               }

            }


            
        </script>

    </table>
</body>

</html>